import GetBuildModel from '../models/getBuild';
let Builds = {
    async getBuild (ctx, next) {
        let items = [];
        let counts = 0;
        await GetBuildModel.get({
            query: ctx.query,
        })
            .then(res => {
                let data = JSON.parse(res.text);
                items = data.data.items;
                counts = data.data.num;

                ctx.body = {
                    code: 0,
                    items,
                    page: ctx.query.page,
                    counts,
                };
            })
            .catch(err => {
                ctx.body = {
                    code: 500,
                    message: err,
                };
            });
    },
};
export default Builds;
